/* GUI CONVERTED from rcmbrp.p (converter v1.76) Fri Aug 24 23:38:00 2001 */
/* rcmbrp.p  -  MASTER BILL PRINT                                             */
/* Copyright 1986-2002 QAD Inc., Carpinteria, CA, USA.                        */
/* All rights reserved worldwide.  This is an unpublished work.               */
/* $Revision: 1.10.1.4 $                                                      */
/*V8:ConvertMode=FullGUIReport                                                */
/* REVISION: 7.5      LAST MODIFIED: 03/18/95   BY: GWM *J049*                */
/* REVISION: 8.5      LAST MODIFIED: 04/22/96   BY: GWM *J0K0*                */
/* REVISION: 8.5      LAST MODIFIED: 05/03/96   BY: jpm *J0L6*                */
/* REVISION: 8.5      LAST MODIFIED: 07/25/96   BY: jpm *J11D*                */
/* REVISION: 8.6      LAST MODIFIED: 08/01/96   BY: *K003* Vinay Nayak-Sujir  */
/* REVISION: 8.5      LAST MODIFIED: 04/07/97   BY: jpm *J1M3*                */
/* REVISION: 8.6      LAST MODIFIED: 04/11/97   BY: *K08N* Steve Goeke        */
/* REVISION: 8.6E     LAST MODIFIED: 02/23/98   BY: *L007* A. Rahane          */
/* REVISION: 8.6E     LAST MODIFIED: 04/21/98   BY: *J2JY* Niranjan R.        */
/* REVISION: 8.6E     LAST MODIFIED: 05/20/98   BY: *K1Q4* Alfred Tan         */
/* REVISION: 8.6E     LAST MODIFIED: 10/04/98   BY: *J314* Alfred Tan         */
/* REVISION: 9.1      LAST MODIFIED: 03/24/00   BY: *N08T* Annasaheb Rahane   */
/* REVISION: 9.1      LAST MODIFIED: 08/12/00   BY: *N0KP* Mark Brown         */
/* Revision: 1.10.1.3     BY: Jean Miller          DATE: 03/22/01 ECO: *P008* */
/* $Revision: 1.10.1.4 $    BY: Manisha Sawant       DATE: 08/20/01 ECO: *P01N* */
/******************************************************************************/
/* All patch markers and commented out code have been removed from the source */
/* code below. For all future modifications to this file, any code which is   */
/* no longer required should be deleted and no in-line patch markers should   */
/* be added.  The ECO marker should only be included in the Revision History. */
/******************************************************************************/

/* DISPLAY TITLE */

/*GUI global preprocessor directive settings */
&GLOBAL-DEFINE PP_PGM_RP TRUE
&GLOBAL-DEFINE PP_ENV_GUI TRUE


/*GUI preprocessor directive settings */
&SCOPED-DEFINE PP_GUI_CONVERT_MODE REPORT

{mfdtitle.i "b+ "}

/* ********** Begin Translatable Strings Definitions ********* */

&SCOPED-DEFINE rcmbrp_p_1 "Ship-To"
/* MaxLen: Comment: */

&SCOPED-DEFINE rcmbrp_p_2 "Shipto"
/* MaxLen: Comment: */

&SCOPED-DEFINE rcmbrp_p_3 "Ship-From"
/* MaxLen: Comment: */

&SCOPED-DEFINE rcmbrp_p_4 "Ship From Site"
/* MaxLen: Comment: */

&SCOPED-DEFINE rcmbrp_p_5 "Form Code"
/* MaxLen: Comment: */

&SCOPED-DEFINE rcmbrp_p_6 "Master ID"
/* MaxLen: 9 Comment: */

&SCOPED-DEFINE rcmbrp_p_7 "Master Bill"
/* MaxLen: Comment: */

/* ********** End Translatable Strings Definitions ********* */

/* LOCAL VARIABLES */
define variable form_code as character format "XX" label {&rcmbrp_p_5} no-undo.
define variable run_file  as character      no-undo.
define variable master    like abs_id       label {&rcmbrp_p_6} no-undo.
define variable master1   like abs_id       no-undo.
define variable shipfrom  like abs_shipfrom label {&rcmbrp_p_4} no-undo.
define variable shipfrom1 like abs_shipfrom no-undo.
define variable shipto    like abs_shipto   label {&rcmbrp_p_2} no-undo.
define variable shipto1   like abs_shipto   no-undo.
define variable lang      like abs_lang     no-undo.
define variable lang1     like abs_lang     no-undo.
define variable carr      like absc_carrier no-undo.
define variable carr1     like absc_carrier no-undo.
define variable fmt       like abs_format   no-undo.
define variable fmt1      like abs_format   no-undo.




/*GUI preprocessor Frame A define */
&SCOPED-DEFINE PP_FRAME_NAME A

FORM /*GUI*/ 
   
 RECT-FRAME       AT ROW 1.4 COLUMN 1.25
 RECT-FRAME-LABEL AT ROW 1   COLUMN 3 NO-LABEL
 SKIP(.1)  /*GUI*/
shipfrom         colon 17 label {&rcmbrp_p_3}
   shipfrom1        colon 49 label {t001.i} skip
   master           colon 17 label {&rcmbrp_p_7}
   master1          colon 49 label {t001.i} skip
   shipto           colon 17 label {&rcmbrp_p_1}
   shipto1          colon 49 label {t001.i}
   fmt              colon 17
   fmt1             colon 49 label {t001.i}
   lang             colon 17
   lang1            colon 49 label {t001.i}
   carr             colon 17
   carr1            colon 49 label {t001.i} skip(1)
   skip(1)
 SKIP(.4)  /*GUI*/
with frame a side-labels attr-space width 80 NO-BOX THREE-D /*GUI*/.

 DEFINE VARIABLE F-a-title AS CHARACTER.
 F-a-title = &IF (DEFINED(SELECTION_CRITERIA) = 0)
  &THEN " Selection Criteria "
  &ELSE {&SELECTION_CRITERIA}
  &ENDIF .
 RECT-FRAME-LABEL:SCREEN-VALUE in frame a = F-a-title.
 RECT-FRAME-LABEL:WIDTH-PIXELS in frame a =
  FONT-TABLE:GET-TEXT-WIDTH-PIXELS(
  RECT-FRAME-LABEL:SCREEN-VALUE in frame a + " ", RECT-FRAME-LABEL:FONT).
 RECT-FRAME:HEIGHT-PIXELS in frame a =
  FRAME a:HEIGHT-PIXELS - RECT-FRAME:Y in frame a - 2.
 RECT-FRAME:WIDTH-CHARS IN FRAME a = FRAME a:WIDTH-CHARS - .5. /*GUI*/

/*GUI preprocessor Frame A undefine */
&UNDEFINE PP_FRAME_NAME



/* SET EXTERNAL LABELS */
setFrameLabels(frame a:handle).

find first soc_ctrl no-lock.
global_site = "".


/*GUI mainloop removed */


/*GUI*/ {mfguirpa.i true "printer" 80 " " " " " "  }

/*GUI repeat : */
/*GUI*/ procedure p-enable-ui:


   if shipfrom1 = hi_char then shipfrom1 = "".
   if master1 = hi_char then master1 = "".
   if shipto1 = hi_char then shipto1 = "".
   if fmt1 = hi_char then fmt1 = "".
   if lang1 = hi_char then lang1 = "".
   if carr1 = hi_char then carr1 = "".

   
run p-action-fields (input "display").
run p-action-fields (input "enable").
end procedure. /* p-enable-ui, replacement of Data-Entry GUI*/

/*GUI*/ procedure p-report-quote:


   bcdparm = "".
   {mfquoter.i shipfrom}
   {mfquoter.i shipfrom1}
   {mfquoter.i master }
   {mfquoter.i master1}
   {mfquoter.i shipto }
   {mfquoter.i shipto1}
   {mfquoter.i fmt}
   {mfquoter.i fmt1}
   {mfquoter.i lang}
   {mfquoter.i lang1}
   {mfquoter.i carr}
   {mfquoter.i carr1}

   if  shipfrom1 = "" then shipfrom1 = hi_char.
   if  shipto1 = "" then shipto1 = hi_char.
   if  fmt1 = "" then fmt1 = hi_char.
   if  master1 = "" then master1 = hi_char.
   if  lang1 = "" then lang1 = hi_char.
   if  carr1 = "" then carr1 = hi_char.

   /* OUTPUT DESTINATION SELECTION */
   
/*GUI*/ end procedure. /* p-report-quote */
/*GUI - Field Trigger Section */

/*GUI MFSELxxx removed*/
/*GUI*/ procedure p-report:
/*GUI*/   {gpprtrpa.i "printer" 80 " " " " " " " " }
/*GUI*/   mainloop: do on error undo, return error on endkey undo, return error:
find first soc_ctrl no-lock.

define buffer abs_temp for abs_mstr.



   printloop:
   for each abs_mstr where
            abs_shipfrom >= shipfrom
        and abs_shipfrom <= shipfrom1
        and abs_shipto >= shipto and abs_shipto <= shipto1
        and abs_id >= "m" + master and abs_id <= "m" + master1
        and abs_format >= fmt and abs_format <= fmt1
        and abs_lang >= lang and abs_lang <= lang1
   no-lock break by abs_shipfrom by abs_id:

      find abs_temp where recid(abs_temp) = recid(abs_mstr)
      exclusive-lock.

      /* The "first" absc_det should be within range, but that
       * record need not have a seq# of 1. The seq# might start
       * from any other # */
      find first absc_det where
                 absc_abs_id = abs_temp.abs_id
      no-lock no-error.
      if available absc_det then do:
         if absc_carrier < carr or
            absc_carrier > carr1 then
            next.
      end.
      else do: /* not available absc_det */
         if carr <> "" or carr1 <> hi_char then
            next.
      end.

      {gprun.i ""icmbpr.p""  "(recid(abs_mstr))" }

      /* MARK PRINTED */
      substring(abs_temp.abs_status,1,1) = "y".

   end. /* PRINTLOOP */

   
/*GUI*/ {mfgrptrm.i} /*Report-to-Window*/
{mfreset.i}

end. /* MAINLOOP */

/*GUI*/ end procedure. /*p-report*/
/*GUI*/ {mfguirpb.i &flds=" shipfrom shipfrom1 master master1 shipto shipto1 fmt fmt1 lang lang1 carr carr1 "} /*Drive the Report*/
